package com.wushi.lenovo.asia5b.app_model.good.bean;

import android.text.TextUtils;

import com.wushi.lenovo.asia5b.app_model.good.DeliveriesBean;
import com.wushi.lenovo.asia5b.app_model.good.PaymentMethodModel;

import java.io.Serializable;
import java.util.Iterator;
import java.util.List;

/**
 * Created by zhangyuncai on 2019/11/12.
 * OrderPaymentPiActivity界面需要的数据
 */
public class OrderPaymentPiBean implements Serializable {
    private List<DeliveriesBean> internationalDeliveries;//国际运输方式
    private List<DeliveriesBean> localDeliveries;//本地运输方式
    private List<PaymentMethodModel.PaymentsBean> payments;//付款方式
    private String errorMsg;

    private String local_delivery_method = null;//本地运输方式
    private String international_delivery_method = null;//国际运输方式
    private String payment_method = null;//付款方式

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getLocal_delivery_method() {
        return local_delivery_method;
    }

    public String getInternational_delivery_method() {
        return international_delivery_method;
    }


    public String getPayment_method() {
        return payment_method;
    }

    public List<DeliveriesBean> getLocalDeliveries() {
        return localDeliveries;
    }

    public void setLocalDeliveries(List<DeliveriesBean> localDeliveries) {
        if(localDeliveries!=null) {
            Iterator<DeliveriesBean> iterator = localDeliveries.iterator();
            while (iterator.hasNext()) {
                DeliveriesBean next = iterator.next();
                if (TextUtils.equals(next.getStatus(), "0")) {//状态为0的不要显示
                    iterator.remove();
                }
            }
        }
        this.localDeliveries = internationalDeliveries;
        if (localDeliveries != null && localDeliveries.size() != 0) {
            this.local_delivery_method = localDeliveries.get(0).getCode();
        }
    }

    public List<DeliveriesBean> getInternationalDeliveries() {
        return internationalDeliveries;
    }

    public void setInternationalDeliveries(List<DeliveriesBean> internationalDeliveries) {
        if(internationalDeliveries!=null) {
            Iterator<DeliveriesBean> iterator = internationalDeliveries.iterator();
            while (iterator.hasNext()) {
                DeliveriesBean next = iterator.next();
                if (TextUtils.equals(next.getStatus(), "0")) {//状态为0的不要显示
                    iterator.remove();
                }
            }
        }
        this.internationalDeliveries = internationalDeliveries;
        if (internationalDeliveries != null && internationalDeliveries.size() != 0) {
            this.international_delivery_method = internationalDeliveries.get(0).getCode();
        }
    }

    public List<PaymentMethodModel.PaymentsBean> getPayments() {
        return payments;
    }

    public void setPayments(List<PaymentMethodModel.PaymentsBean> payments) {
        this.payments = payments;
        if (payments != null && payments.size() != 0) {
            this.payment_method = payments.get(0).getCode();
        }
    }

}
